import java.awt.*;
import java.awt.Color;

class Automobile{
	Color c;
	int totalCapacity;
	public Automobile(Color c, int person){
		this.c = c;
		totalCapacity = person;
	}
	public int getCapacity(){
		return totalCapacity;
	}
	public void setCapacity(int c){
		totalCapacity = c;
	}
}

class Sedan extends Automobile{
	public Sedan(Color c, int totalCapacity){
		super(c, totalCapacity);
	}
}
class Minivan extends Automobile{
	public Minivan(Color c, int totalCapacity){
		super(c, totalCapacity);
	}
}
class Sportscar extends Automobile{
	public Sportscar(Color c, int totalCapacity){
		super(c, totalCapacity);
	}
}
public class Car{
	public static void main(String[] ar){
		int Sedanperson = 4;
		int Minivanperson = 7;
		int Sportscarperson = 2;

	Automobile[] fleet = new Automobile[3];

	fleet[0] = new Sedan(Color.black,Sedanperson);
	fleet[1] = new Minivan(Color.red, Minivanperson);
	fleet[2] = new Sportscar(Color.white, Sportscarperson);

	int totalCapacity = 0;

	for(int i = 0; i < fleet.length; i++){
		if(fleet[i] instanceof Sedan)
			totalCapacity += ((Sedan)fleet[i]).getCapacity();
		else if(fleet[i] instanceof Minivan)
			totalCapacity += ((Minivan)fleet[i]).getCapacity();
		else if(fleet[i] instanceof Sportscar)
			totalCapacity +=((Sportscar)fleet[i]).getCapacity();
		else
			totalCapacity += fleet[i].getCapacity();
	}
	totalCapacity = 0;
	for(int i = 0; i< fleet.length; i++)
		totalCapacity += fleet[i].getCapacity();

	System.out.println("Sedan : " + fleet[0].getCapacity());
	System.out.println("Minivan : " + fleet[1].getCapacity());
	System.out.println("Sportscar : " + fleet[2].getCapacity());
	System.out.println("Total : " + totalCapacity);
	}
}
